| Conditions | 2 |
| Total Lines | 19 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Inject } from '@nestjs/common'; |
||
| 18 | |||
| 19 | public async execute(command: CreateNotificationCommand): Promise<string> { |
||
| 20 | const { message, type, leaveReaquest } = command; |
||
| 21 | |||
| 22 | if (type === NotificationType.POST) { |
||
| 23 | const { id } = await this.mattermostNotifier.createPost(MATTERMOST_CHANNEL_LEAVES_ID, message); |
||
| 24 | const notification = await this.notificationRepository.save( |
||
| 25 | new Notification( |
||
| 26 | type, |
||
| 27 | message, |
||
| 28 | id, |
||
| 29 | leaveReaquest |
||
| 30 | ) |
||
| 31 | ); |
||
| 32 | |||
| 33 | return notification.getId(); |
||
| 34 | } |
||
| 35 | |||
| 36 | throw new Error('Type not managed'); |
||
| 37 | } |
||
| 39 |